package com.zjdiepu.www.proxy.impl;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import com.diepu.www.client.proxy.partner.request.own.DiepuYwOpenCardHzicbcRequest;
import com.zjdiepu.www.config.ClientConfig;
import com.zjdiepu.www.consts.ProxyService;
import com.zjdiepu.www.net.HttpClient;
import com.zjdiepu.www.proxy.DiepuOpenCardHzicbcService;
import com.zjdiepu.www.response.BooleanResponse;
import com.zjdiepu.www.security.base.enums.ResultCode;
import com.zjdiepu.www.security.client.encode.BaseEncryptService;
import com.zjdiepu.www.security.exception.BasePartnerException;
import com.zjdiepu.www.security.server.core.Partners;
@Service
public class DiepuOpenCardHzicbcServiceImpl extends BaseEncryptService implements DiepuOpenCardHzicbcService{

	@Override
	public BooleanResponse applyIcbcOpenCardInterface(DiepuYwOpenCardHzicbcRequest diepuYwOpenCardHzicbcRequest, Partners partner) throws BasePartnerException {
		
		//签名
		String signEncrypt = signEncrypt(diepuYwOpenCardHzicbcRequest, partner);
		if(StringUtils.isBlank(signEncrypt)) 
		{
			throw new BasePartnerException(ResultCode.FAIL_PARAM_EMPTY);
		}
		String noticeStatus = HttpClient.postJson(ClientConfig.getPartnerGateWay(partner) + ProxyService.DIEPUOPENCARDAPPLY, signEncrypt);
		return valdateDencrypt(noticeStatus, BooleanResponse.class, partner);
	}

}
